<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .red{
            color: red
        }
        .f60{
            font-size: 60px;
        }
    </style>
</head>
<body>
    <div id="app">
        <h1 :class="stringRed">{{msg}}</h1>
        <h1 :class="{red:isRed, f60:isF60}">{{msg}}</h1>
        <p class="box" :class="getClass()">{{msg}}</p>
        <p class="box" :class="[red, f60]">{{msg}}</p>
        <button @click="change">
            改变
        </button>
    </div>
    <script src="../js/vue.js"></script>
    <script>
        const app = Vue.createApp({
            data() {
                return {
                    msg: "闭关修炼",
                    stringRed: "red",
                    red:"red",
                    f60:"f60",
                    isRed: true,
                    isF60:true,
                }
            },
            methods:{
                change(){
                    this.isRed = !this.isRed;
                    this.isF60 = !this.isF60;
                },
                getClass(){
                    return {
                        red: this.isRed,
                        f60: this.isF60,
                    };
                }
            }
        }).mount("#app");
    </script>
</body>
</html>